﻿using System;
using System.Data;
using System.Collections.Generic;
using SERP.DAO;
namespace SERP.Controllers{
public class SalaryFieldsControllerBase : Controller{
	public SalaryFieldsControllerBase()
		: base()
	{
	}
	private static SalaryFieldsDAO _Service; 
	public static SalaryFieldsDAO Service{
		get{
			if(_Service==null)
				_Service = new SalaryFieldsDAO();
			return _Service;
		}
		set{
			_Service = value;
		}
	}
    //Copy data from data row in grid to object
    public SalaryFieldsEntity MapDataRowToObject(DataRow row){
		SalaryFieldsEntity o = new SalaryFieldsEntity();
		 o.FieldCode=Convert.ToString(row["FieldCode"]);
		 o.FieldName=Convert.ToString(row["FieldName"]);
		 o.FieldNote=Convert.ToString(row["FieldNote"]);
		 if(!row.IsNull("FieldType"))
			o.FieldType=ConvertByte(row["FieldType"]);
		 if(!row.IsNull("SalaryFieldId"))
		    o.SalaryFieldId=(Int32)(row["SalaryFieldId"]);
		 return o;
    }
	//Copy data from object to data row in grid    
    public void MapObjectToDataRow(SalaryFieldsEntity o,DataRow row){
		row["FieldCode"]=o.FieldCode;
		row["FieldName"]=o.FieldName;
		row["FieldNote"]=o.FieldNote;
		row["FieldType"]=o.FieldType;
		row["SalaryFieldId"]=o.SalaryFieldId;
    }
}
}
